/**
 * 
 */
var params={};
$(function() {
	//adaptive();
	params={size:12,type:2,title:$('#mul-media-sear-field').val()};
	loadDataPageIetm("/ietm/multimediaN", "srcoll-documentation", "lists",params);
	//注释搜索
	$('#mul-media-sear').click(function(){
		$('#lists').html("");
		params={size:12,type:2,title:$('#mul-media-sear-field').val()};
		loadDataPageIetm("/ietm/multimediaN", "srcoll-documentation", "lists",params);
	});
});
//分页查询，对结果的处理
function dataKk(data, me) {
	data=data.rows;
	var result = '';
	var arrLen = data.length;
	if (arrLen > 0) {
		for (var i = 0; i < arrLen; i++) {
			result +='<li onclick="openDiaalog(this)" url="'+data[i].url+'" mulTitle="'+data[i].title+'">'
					+'<div class="paper-a">标题：'+data[i].title+'</div> '
					+'<div class="multimedia-a">ICN编码：'+data[i].code+'</div>'
					+'<div class="multimedia-a">数据模块编码：'+data[i].dmCode+'</div> </li>' ;
		}
	} else {
		me.lock();
		me.noData();
	}
	return result;
}

function openDiaalog(url,title){
	var content="";
	if(url.toLowerCase().indexOf('.pdf')>-1)
			content="<iframe width='100%' src='viewer.html' height='100%' id='reportshow' name='reportshow' scrolling='no' frameborder='0'></iframe>";
	else if(url.toLowerCase().indexOf('.swf')>-1)
	 content= '<div style="height:500px;width:1200px;text-align:center;">'
				 +'<object id="flash" classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" width="1200px" align="middle" height="500px" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0">'
				 +'<param name="movie" value='+url+'>'
				 +'<param name="quality" value="high">'
				 +'<param name="bgcolor" value="#F0F0F0">'
				 +'<param name="menu" value="false">'
				 +'<param name="wmode" value="opaque">'
				 +'<param name="FlashVars" value="">'
				 +'<param name="allowScriptAccess" value="sameDomain">'
				 +'<embed src="'+url+'" quality="high" bgcolor="#ffffff" width="1200px" height="500px" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" /> ' 
				 +'</object></div>';
	else if(url.toLowerCase().indexOf('.avi')>-1||url.toLowerCase().indexOf('.wmv')>-1||url.toLowerCase().indexOf('.mpg')>-1||url.toLowerCase().indexOf('.mpeg')>-1)
		 content= '<div style="height:500px;width:100%;text-align:center;">'
			 	  +'<object id="MediaPlayer" width="100%" height="500px"  classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject">'
			 	  +'<param name="windowlessVideo" value="1">'
			 	  +'<param name="ShowPositionControls" value="0"/>'
			      +'<param name="AutoStart" value="0"/>'
			 	  +'<param name="EnableContextMenu" value="0"/>'  
			 	  +'<param name="URL" value='+url+' />' 
			 	  +'</object></div>';  
	else if(url.toLowerCase().indexOf('.unity3d')>-1)
		 content= '<div style="height:500px;text-align:center;">'
					 +'<object id="u3ds" classid="CLSID:444785F1-DE89-4295-863A-D46C3A781394" width="100%"  height="500px" display:block >'
					 +'<param name="src" value='+url+'/>'
					 +'<param name="firstFrameCallback" value="UnityObject2.instances[0].firstFrameCallback();">'
					 +'<param name="enableDebugging" value="0">'
					 +'<param name="disableContextMenu" value="true">'
					 +'</object></div>';
	else if(url.toLowerCase().indexOf('.cgm')>-1)
		 content= '<div style="height:600px;width:1200px;text-align:center;">'
					 +'<object id="cgms" classid="CLSID:1D4A81CB-25A3-4EB7-A75E-4F8A5386D8F8" width="1200px"  height="500px" data='+url+'></object></div>';

	 var index =  top.layer.open({
		  type: 1,
		  title: title,
		  content: content,
		  resize:false,
		  area: ['800px', '550px'],
		  maxmin: true,
		  btn: ['关闭'],
		  yes: function(index, layero){
    	  top.layer.close(index);
		  },
		  end: function () {
				// $("#frameReft").load("/ietm/multimedia?random="+Math.random());
          }
		});
	 top.layer.full(index);
	/*  var diag = new $.Zebra_Dialog(content,{
          width:1200,
          title:title,
          buttons: ['关闭']
      });*/
}